﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Forget.HRBLL.Logical;

namespace HRWebSite.Sys
{
    public partial class EditAuthority : BasePage
    {
        protected override void Page_Load(object sender, EventArgs e)
        {
            this.HRLimitAttribute = Forget.HRBLL.LimitAttribute.Read | Forget.HRBLL.LimitAttribute.Delete | Forget.HRBLL.LimitAttribute.Modify | Forget.HRBLL.LimitAttribute.Add;
            this.HRLimits = Limits.LimitManage;
            base.Page_Load(sender, e);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (!UserLimitLogical.AddLimit(this.TextBox1.Text, this.TextBox2.Text, this.RadioButton1.Checked))
                this.Literal1.Text = "<span style=\"color: #FF0000\">此次操作失败，请咨询管理员！</span>";
            else
                this.Literal1.Text = string.Format("<script>alert('权限[{0}]添加成功，按确定继续');location='../sys/EditAuthority.aspx';</script>", this.TextBox2.Text);
        }        
    }
}